﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ITOMMS.Entity;

namespace ITOMMS.Web.TroubleManage
{
    public partial class TroubleShow : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.Params["id"] != null)
                {
                    string sid = Request.Params["id"].ToString();
                    int pid = 0;
                    if (int.TryParse(sid, out pid))
                    {
                        DataShow(pid);
                    }
                }
            }
        }

        private void DataShow(int troubleId)
        {
            VwTroubleFormEntity entity = new VwTroubleFormEntity();
            entity = entity.FindEntity("ID=" + troubleId);
            if (entity != null)
            {
                this.lblServiceClass.Text = entity.ServiceClassName;
                lblTroubleNo.Text = entity.TroubleNo;
                this.lblShortTitle.Text = entity.ShortServiceName;
                this.lblTroubleClass.Text = entity.ClassName ;
                this.lblTroubleEquipment.Text = entity.AssetName;
                this.lblTroubleDescription.Text = entity.TroubleDescription;
            }
        }

        protected void btnBack_ServerClick(object sender, EventArgs e)
        {
            Response.Redirect("TroubleList.aspx");
        }

    }
}
